package com.ujiuye.servlet;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.ujiuye.service.service;
import com.ujiuye.utils.pagetools;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;

@WebServlet("/abcd")
public class servlet extends baseservlet{
    private service service =new service();
    /**
     * 分页模糊
     * @param req
     * @param resp
     */
    public void dimQuery(HttpServletRequest req, HttpServletResponse resp)throws IOException {
//        //当前页
//        currentPage:1,
//        //每页条数
//        pageSize:6,
//        //条件
//        search:"",
        String currentPage = req.getParameter("currentPage");
        String pageSize = req.getParameter("pageSize");
        String search = req.getParameter("search");
        pagetools pt = service.query(currentPage,pageSize,search);

        String json = new ObjectMapper().writeValueAsString(pt);
        resp.getWriter().print(json);
    }
}
